const baseUrl = import.meta.env.VITE_APP_BASE_API;
const url = baseUrl + "/sse/connect?type={type}&custom={custom}&clientId={clientId}"

export function initSSEInstance(type, custom, clientId) {
    // 参数校验
    if (!type || !custom || !clientId) {
        console.error("type, custom, clientId is required")
        return
    }
    const reqUrl = url.replace("{type}", type).replace("{custom}", custom).replace("{clientId}", clientId);
    return new EventSource(reqUrl)
}